<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #container {
      width: 100%;
      height: 400px;
      margin: 20px;
    }

    h2,
    h3 {
      text-align: center;
    }
  </style>
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.3.0/dist/echarts.min.js"></script>
</head>

<body>
  <h2>登陆成功</h2>
  <h3>dashboard页面</h3>
  <div id="container"></div>
  <script>
    var dom = document.getElementById("container")
    var myChart = echarts.init(dom)
    const url = 'http://10.0.0.24:4444'
    fetch(url + '/dashboard')
      .then(res => res.json())
      .then(([week, data]) => {
        console.log(week, data)
        var option = {
          xAxis: {
            type: 'category',
            data: week
          },
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'cross',
              label: {
                backgroundColor: '#6a7985'
              }
            }
          },
          yAxis: {
            type: 'value'
          },
          series: [
            {
              data,
              type: 'line',
              smooth: true
            }
          ]
        }
        myChart.setOption(option)
      })

  </script>
</body>

</html>